﻿using System.Collections.ObjectModel;
using System.Text;
using WorkFlow.Engine;
using WorkFlow.Engine.NSPermission;

namespace WorkFlow.web.PublicCode
{
    public class Deps
    {
        public string GetDeps(string strActId)
        {
            int actID = -1;
            if (!int.TryParse(strActId.Trim(), out actID)) return null;

            ReadOnlyCollection<WfOrgStruct> list =
                WfActivityController.CreateActivityController().GetNextCommonActivitiesAllOrgs(actID);
            //construct datatable
            int count = list == null ? 0 : list.Count;
            if (count == 0) return null;
            var txt = new StringBuilder();
            // <option value=""  wfinhertfrom=""></option>
            for (int i = 0; i < count; i++)
            {
                txt.Append(string.Format(
                    @"<option value='{0}'  wfinhertfrom='{1}' wfact='{3}' wfabs='{4}'>{2}</option>",
                    list[i]._id,
                    list[i]._privilegeRuleID, list[i]._name, list[i]._runActID, list[i]._abstractID));
            }
            return txt.ToString();
        }
    }
}